package com.dataseek.iot.start;

import com.dataseek.iot.redis.util.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.oas.annotations.EnableOpenApi;

/**
 * @author cc
 * @Title: start
 * @Description: start
 * @date 2021/8/265:13 下午
 * @since 1.0
 */
@EnableOpenApi
@SpringBootApplication(scanBasePackages = {"com.dataseek.iot", "com.dataseek.iot.redis"})
@EnableAutoConfiguration
@EnableScheduling
@EnableCaching
@MapperScan("com.dataseek.iot.**.mapper")
@Slf4j
public class Start implements ApplicationRunner {

    @Autowired
    RedisUtil redisUtil;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        //启东时，清除所有缓存
        redisUtil.removeAll();
        log.info("初始化缓存");
    }

    public static void main(String[] args) {
         SpringApplication.run(Start.class,args);
    }


}
